package org.ccams.dao;

import java.util.List;

import org.ccams.domain.TGoodstype;
import org.ccams.util.PageParameter;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

public class TGoodstypeDAO extends SqlMapClientDaoSupport{
    public TGoodstypeDAO() {
        super();
    }
    public int insert(TGoodstype record) {
        return getSqlMapClientTemplate().update("t_goodstype.abatorgenerated_insert", record);
    }
    public int updateByPrimaryKey(TGoodstype record) {
        int rows = getSqlMapClientTemplate().update("t_goodstype.abatorgenerated_updateByPrimaryKey", record);
        return rows;
    }
    public int updateByPrimaryKeySelective(TGoodstype record) {
        int rows = getSqlMapClientTemplate().update("t_goodstype.abatorgenerated_updateByPrimaryKeySelective", record);
        return rows;
    }

   
    public TGoodstype selectByPrimaryKey(Integer idtGoodstype) {
        TGoodstype key = new TGoodstype();
        key.setIdtGoodstype(idtGoodstype);
        TGoodstype record = (TGoodstype) getSqlMapClientTemplate().queryForObject("t_goodstype.abatorgenerated_selectByPrimaryKey", key);
        return record;
    }

    
    public int deleteByPrimaryKey(Integer idtGoodstype) {
        TGoodstype key = new TGoodstype();
        key.setIdtGoodstype(idtGoodstype);
        int rows = getSqlMapClientTemplate().delete("t_goodstype.abatorgenerated_deleteByPrimaryKey", key);
        return rows;
    }
    /**
	 * 返回指定页码的品牌
	 * @return
	 */
	@SuppressWarnings({ "unchecked", "deprecation" })
	public  List<TGoodstype> getTGoodstype(PageParameter pageParmeter){		
		return getSqlMapClientTemplate().queryForList("t_goodstype.getByPage", pageParmeter);
	}
	
	/**
	 * 返回记录总数
	 * @return
	 */
	public int getCount(){
		return (Integer)getSqlMapClientTemplate().queryForObject("t_goodstype.getCount");
	}
	/**
	 * 返回所有品牌
	 * @return
	 */
	@SuppressWarnings("unchecked")
	public  List<TGoodstype> getAll(){		
		return getSqlMapClientTemplate().queryForList("t_goodstype.getAll");
	}
}